
app.controller('openstackDetailModalCtrl', ['$scope', 'httpLoad', '$rootScope','$modal','$state','$timeout',
     function($scope, httpLoad, $rootScope, $modal,$state, $timeout) {
       $rootScope.link = '/statics/css/user.css';
       $rootScope.moduleTitle = '软件仓库 > <span ui-sref=app.sortware.openstack>仓库</span> > 详情';
       $scope.goBack = function(){
           $state.go('app.sortware.openstack');
       };
     }
 ]);
app.controller('basicOpenstackModalCtrl', ['$rootScope', '$scope','$state','httpLoad','$stateParams',function($rootScope, $scope,$state,httpLoad,$stateParams) {

    $scope.param = {
        rows: 10
    };
    (function(){
      var id = $stateParams.id;
    httpLoad.loadData({
        url:'/registry/detail',
        method:'GET',
        data: {id: id},
        success:function(data){
            if(data.success&&data.data){
                $scope.supplierDetail = data.data;
                $scope.showDetail = $scope.isActive = true;

            }
        }
    });
    })();
    $scope.goBack = function(){
        $state.go('app.sortware.openstack');
    };
}]);
app.controller('openstackModalCtrl', ['$rootScope', '$scope','$state','httpLoad','LANGUAGE','$stateParams',
function($rootScope, $scope,$state,httpLoad,LANGUAGE,$stateParams) {

    $scope.param = {
        rows: 10
    };
    $scope.selectTab = function (page) {
    	 var port = $stateParams.port;
      $scope.param.page = page || $scope.param.page;
      $scope.param.id = $stateParams.id;
      httpLoad.loadData({
        url: '/registry/images',
        method: 'POST',
        data: $scope.param,
        success: function (data) {
          if (data.success) {
            $scope.countData = data.data.rows;
            $scope.totalCount = data.data.total;
          }
        }
      });
    };
    $scope.goAction = function (flag, id, $event) {
      switch (flag / 1) {
        case 1:
        var modalInstance = $modal.open({
            templateUrl : '/statics/tpl/sortware/openstack/add.html',
            controller : 'addtenantModalCtrl',// 初始化模态范围
            //size : sm, //大小配置
            resolve : {
              id : function(){
                return id;
              },
            }
        });
        modalInstance.result.then(function(){
            $scope.getData(1);
        },function(){});

          break;
        case 2:
        //部署
    	 $scope.pop(LANGUAGE.MONITOR.APP_MESS.ADD_SUCCESS);

          break;
        case 3:
          //删除
              if($event) $event.stopPropagation();
              var ids=[];
              ids.push(id);
              var modalInstance = $modal.open({
                templateUrl : '/statics/tpl/sortware/openstack/remove.html',
                controller : 'removeUserModalCtrl',
                resolve : {
                  id : function(){
                    return ids;
                  },

                }
              });
              modalInstance.result.then(function(){
                $scope.getData(1);
                $scope.isCheck = false;
              },function(){});

          break;

      }
    };

    $scope.goBack = function(){
        $state.go('app.sortware.openstack');
    };
}]);
app.controller('historyOpenstackModalCtrl', ['$rootScope', '$scope','$state','httpLoad','$stateParams',function($rootScope, $scope,$state,httpLoad,$stateParams) {
	$rootScope.link = '/statics/css/alarm.css';//引入页面样式
	 var searchParam = [];
		searchParam.push({"param":{"object":"registry","id":$stateParams.id,},"sign":"LK"});
	var params = searchParam;
	$scope.selectTab = function () {
    httpLoad.loadData({
      url: '/log/audit/list',
        method:'POST',
        data: params,
        success:function(data){
            if(data.success&&data.data){
                $scope.userList = data.data.rows;

            }

        }
    });
  }
    $scope.goBack = function(){
        $state.go('app.sortware.openstack');
    };
}]);
